<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="author" content="ykf">
    <title>练习</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
</html>
<script>
    function People(name,age,isMale){
        this.name = name;
        this.age = age;
        this.isMale = isMale;
    }
    this.say = function(){
        console.log(this.name+'说hello');
    }
    say();
    // Boy------------------
    function Boy(name,age,isMale){
        People.call(this,name,age,isMale);
    }
    function Temp(){};
    Temp.prototype = People.prototype;
    var obj = new Temp();
    Boy.prototype = obj;

    Boy.prototype.say = function(){
        console.log(this.name+'说hello');
    }
    Boy.prototype.play = function(game,hours){
        console.log(this.name+'玩'+game+hours+'小时');
    }
    Boy.prototype.constructor = Boy;
    var boy = new Boy('tom',20,true);
    console.dir(boy);
    boy.say();
    boy.play('消消乐',2);
    // console.log(boy.name);
    // console.log(boy.age);
    // console.log(boy.isMale);


    // Girl-------------------------
    function Girl(name,age,isMale){
        People.call(this,name,age,isMale);
    }
    function Temp1(){};
    Temp1.prototype = People.prototype;
    var obj1 = new Temp1();
    Boy.prototype = obj1;

    Girl.prototype.isLongHair = true;

    Girl.prototype.say = function(){
        console.log(this.name+'说hello');
    }
    Girl.prototype.goshopping = function(place,hours){
        console.log(this.name+'去'+place+'逛街'+hours+'小时');
    }
    var girl = new Girl('lily',21,false);
    console.dir(girl);
    girl.say();
    girl.goshopping('二七广场',3);

</script>